import { S } from '../../s';
import { IPSControlAction } from '../ipscontrol-action';
import { IPSControlNavContext } from '../ipscontrol-nav-context';
import { IPSControlNavParam } from '../ipscontrol-nav-param';
import { IPSDEEditForm } from './ipsdeedit-form';
import { IPSDEWizardEditForm } from './ipsdewizard-edit-form';
import { IPSWFEditForm } from './ipswfedit-form';
import { PSDEFormImpl } from './psdeform-impl';
import { IPSDEWizardForm } from '../../dataentity/wizard/ipsdewizard-form';

export class PSDEEditFormImpl
  extends PSDEFormImpl
  implements IPSDEEditForm, IPSDEWizardEditForm, IPSWFEditForm
{
  get activeDataField(): string {
    return this.M.activeDataField;
  }

  protected createpscontrolaction: IPSControlAction;
  getCreatePSControlAction(): IPSControlAction | null {
    if (this.createpscontrolaction != null) return this.createpscontrolaction;
    const value = this.M.getCreatePSControlAction;
    if (value == null) {
      return;
    }
    this.createpscontrolaction =
      this.getPSControlHandler().findPSControlHandlerAction(value);
    return this.createpscontrolaction;
  }

  protected getdraftfrompscontrolaction: IPSControlAction;
  getGetDraftFromPSControlAction(): IPSControlAction | null {
    if (this.getdraftfrompscontrolaction != null)
      return this.getdraftfrompscontrolaction;
    const value = this.M.getGetDraftFromPSControlAction;
    if (value == null) {
      return;
    }
    this.getdraftfrompscontrolaction =
      this.getPSControlHandler().findPSControlHandlerAction(value);
    return this.getdraftfrompscontrolaction;
  }

  protected getdraftpscontrolaction: IPSControlAction;
  getGetDraftPSControlAction(): IPSControlAction | null {
    if (this.getdraftpscontrolaction != null)
      return this.getdraftpscontrolaction;
    const value = this.M.getGetDraftPSControlAction;
    if (value == null) {
      return;
    }
    this.getdraftpscontrolaction =
      this.getPSControlHandler().findPSControlHandlerAction(value);
    return this.getdraftpscontrolaction;
  }

  protected getpscontrolaction: IPSControlAction;
  getGetPSControlAction(): IPSControlAction | null {
    if (this.getpscontrolaction != null) return this.getpscontrolaction;
    const value = this.M.getGetPSControlAction;
    if (value == null) {
      return;
    }
    this.getpscontrolaction =
      this.getPSControlHandler().findPSControlHandlerAction(value);
    return this.getpscontrolaction;
  }

  protected gobackpscontrolaction: IPSControlAction;
  getGoBackPSControlAction(): IPSControlAction | null {
    if (this.gobackpscontrolaction != null) return this.gobackpscontrolaction;
    const value = this.M.getGoBackPSControlAction;
    if (value == null) {
      return;
    }
    this.gobackpscontrolaction =
      this.getPSControlHandler().findPSControlHandlerAction(value);
    return this.gobackpscontrolaction;
  }

  protected pscontrolnavcontexts: IPSControlNavContext[];
  getPSControlNavContexts(): IPSControlNavContext[] | null {
    return (
      this.pscontrolnavcontexts ||
      (this.pscontrolnavcontexts = this.fillChildListModel(
        this.M.getPSControlNavContexts,
        S._38c,
      ) as IPSControlNavContext[])
    );
  }

  findPSControlNavContext(objKey: any): IPSControlNavContext | null {
    return this.getPSModel5(
      S._38c,
      this.getPSControlNavContexts(),
      objKey,
    ) as IPSControlNavContext;
  }

  protected pscontrolnavparams: IPSControlNavParam[];
  getPSControlNavParams(): IPSControlNavParam[] | null {
    return (
      this.pscontrolnavparams ||
      (this.pscontrolnavparams = this.fillChildListModel(
        this.M.getPSControlNavParams,
        S._38b,
      ) as IPSControlNavParam[])
    );
  }

  findPSControlNavParam(objKey: any): IPSControlNavParam | null {
    return this.getPSModel5(
      S._38b,
      this.getPSControlNavParams(),
      objKey,
    ) as IPSControlNavParam;
  }

  protected psdewizardform: IPSDEWizardForm;
  getPSDEWizardForm(): IPSDEWizardForm | null {
    return (
      this.psdewizardform ||
      (this.psdewizardform = this.fillObjectModel(
        S._211,
        this.M.getPSDEWizardForm,
        S._317,
      ) as IPSDEWizardForm)
    );
  }

  protected removepscontrolaction: IPSControlAction;
  getRemovePSControlAction(): IPSControlAction | null {
    if (this.removepscontrolaction != null) return this.removepscontrolaction;
    const value = this.M.getRemovePSControlAction;
    if (value == null) {
      return;
    }
    this.removepscontrolaction =
      this.getPSControlHandler().findPSControlHandlerAction(value);
    return this.removepscontrolaction;
  }

  protected updatepscontrolaction: IPSControlAction;
  getUpdatePSControlAction(): IPSControlAction | null {
    if (this.updatepscontrolaction != null) return this.updatepscontrolaction;
    const value = this.M.getUpdatePSControlAction;
    if (value == null) {
      return;
    }
    this.updatepscontrolaction =
      this.getPSControlHandler().findPSControlHandlerAction(value);
    return this.updatepscontrolaction;
  }

  protected wfstartpscontrolaction: IPSControlAction;
  getWFStartPSControlAction(): IPSControlAction | null {
    if (this.wfstartpscontrolaction != null) return this.wfstartpscontrolaction;
    const value = this.M.getWFStartPSControlAction;
    if (value == null) {
      return;
    }
    this.wfstartpscontrolaction =
      this.getPSControlHandler().findPSControlHandlerAction(value);
    return this.wfstartpscontrolaction;
  }

  protected wfsubmitpscontrolaction: IPSControlAction;
  getWFSubmitPSControlAction(): IPSControlAction | null {
    if (this.wfsubmitpscontrolaction != null)
      return this.wfsubmitpscontrolaction;
    const value = this.M.getWFSubmitPSControlAction;
    if (value == null) {
      return;
    }
    this.wfsubmitpscontrolaction =
      this.getPSControlHandler().findPSControlHandlerAction(value);
    return this.wfsubmitpscontrolaction;
  }

  get activeDataMode(): boolean {
    return this.M.activeDataMode != null ? this.M.activeDataMode : false;
  }

  get enableAutoSave(): boolean {
    return this.M.enableAutoSave != null ? this.M.enableAutoSave : false;
  }

  get infoFormMode(): boolean {
    return this.M.infoFormMode != null ? this.M.infoFormMode : false;
  }

  get readOnly(): boolean {
    return this.M.readOnly != null ? this.M.readOnly : false;
  }

  get showFormNavBar(): boolean {
    return this.M.showFormNavBar != null ? this.M.showFormNavBar : false;
  }
  get cls(): string {
    return 'PSDEEditFormImpl';
  }
  instanceof(cls: string): boolean {
    if (
      cls == S._23e ||
      cls == S._23f ||
      cls == S._240 ||
      cls == S._241 ||
      cls == S._242
    )
      return true;
    return super.instanceof(cls);
  }
}
